﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using yq.ControllerBase;

namespace yq.Controller.Sys
{
    public class InfoController : BaseController
    {
        public ActionResult Index()
        {
           var model= yq.Model.Logic.SysInfo.Load(yq.ControllerBase.WebConfig.WebId);

           return View(model);
        }

        /// <summary>
        /// 修改配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [ErrorFilter("修改系统配置失败", ErrorFilterType.ReturnValue)]
        public ActionResult DoEdit()
        {
            var model = yq.Model.Logic.SysInfo.Load(yq.ControllerBase.WebConfig.WebId);
            TryUpdateModel(model);
            yq.Dictionary.ReturnValue<string> rv = new Dictionary.ReturnValue<string>();

            model.WebId = yq.ControllerBase.WebConfig.WebId;

            bool b= yq.GetService.Create<yq.IService.ISys>().EditInfo(model);

            if (b)
            {
                rv.True(model.WebId);
            }
            else
            {
                rv.False("修改失败");
            }

            return Json(rv);
        }

    }
}
